import request from '@/utils/request'
import qs from 'qs'

//文章列表查询
export const articleListService = (params: any) =>{
    return request.get('/articleManagement/page',{params:params})
}
//添加文章
export const addArticleService = (userForm: any)=>{
    return request.post('/articleManagement',userForm)
}
//修改文章
export const updateArticleService = (userForm: any)=>{
    return request.put('/articleManagement',userForm)
}
//删除文章
export const deleteArticleService = (id: number)=>{
    return request.delete('/articleManagement/'+id)
}
//批量删除文章
export const deleteBatchArticleService = (params: any)=>{
    //qs库转换数组格式
    //{arrayFormat: 'repeat'}为：?ids=1&ids=2
    return request.delete('/articleManagement',{params:params ,paramsSerializer: function(params){
        return qs.stringify(params,{arrayFormat: 'repeat'})
    }})
}
//查询文章分类
export const selectArticleCategory = () =>{
    return request.get('/articleManagement/category')
}
//用户查询文章列表集合
export const selectArticleListService = () =>{
    return request.get('/articleManagement/user')
}
//用户查询文章详情
export const selectArticleService = (id: number) =>{
    return request.get('/articleManagement/user/' + id)
}